Ad Widget

Collapse

API Problems with undefined method `each_char'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jschnip
    Junior Member
    • Feb 2010
    • 2

    #1

    API Problems with undefined method `each_char'

    I am trying to get the API working on a fresh install, however I can't get around the following error when doing a login:
    Code:
    login http://127.0.0.1/zabbix zabcon password
    ./cli_libs/argument_processor.rb:88:in `safe_split': undefined method `each_char' for "http://127.0.0.1/zabbix admin zabbix":String (NoMethodError)...
    I did find a reference on the net to the undefined method 'each_char' with a workaround adding this to the cli_libs/argument_processor.rb:
    Code:
    require 'jcode'
    Then the error changes to:
    ./zabbixapi.rb:143:in `initialize': undefined method `+' for nil:NilClass (NoMethodError)...
    after looking at that line
    Code:
    @url=URI.parse(url+'/api_jsonrpc.php')
    and trying a change to
    Code:
    @url=URI.parse('http://127.0.0.1/zabbix/api_jsonrpc.php')
    the following error is thrown:
    Login error, incorrect login information
    Server: User: password:
    ./cli_libs/printer.rb:291:in `print': undefined method `[]' for false:FalseClass (NoMethodError)...
    I'm wondering if anyone else has any ideas, because it doesn't seem like I can work around the problem. Wondering if its a version issue, etc?

    Version Info:
    centos 5.4
    zabbix 1.8.1
    ruby 1.8.5
    gem 1.3.5

    I have also tried the zabbixapi.rb (updating server, username, password)
    and the first few commands seem to run fine, but then it errors on:
    Getting by username, admin, number should be seen
    zabbixapi.rb:250:in `do_request': ZbxAPI_GeneralError
    from zabbixapi.rb:310:in `do_request'
    from zabbixapi.rb:360:in `getid'
    from zabbixapi.rb:837
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    I'll have a look in a little bit and get back to you.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • jschnip
      Junior Member
      • Feb 2010
      • 2

      #3
      Thanks for offering to take a look - has anyone identified a possible cause &/or fix for this?

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        Interesting, I've not run into the jcode require before, but I can see how it can be a workaround.

        As for the other component that looks like a new bug. I'll be fixing that shortly.
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        Working...